﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace AI.FSM
{
    /// <summary>
    /// 追逐
    /// </summary>
    public class PursuitState : FSMState
    {
        protected override void Init()
        {
            StateID = FSMStateID.Pursuit;
        }
        public override void EnterState(FSMBase fsm)
        {
            base.EnterState(fsm);
            fsm.chAnim.SetBool(fsm.chStatus.animParams.Run,true);
        }
        public override void Action(FSMBase fsm)
        {
            base.Action(fsm);
            if (fsm.targetTF != null)
            {
                fsm.MoveToTarget(fsm.targetTF.position,fsm.runSpeed,fsm.chStatus.attackDistance);
            }
        }
        public override void ExitState(FSMBase fsm)
        {
            base.ExitState(fsm);
            fsm.chAnim.SetBool(fsm.chStatus.animParams.Run, false);
            //停止移动
            fsm.StopMove();
        }
    }
}

